<template>
  <div class="search">
    <!-- 搜索部分 -->
    <div class="search">
      <van-row justify="center">
          <van-col span="24">
            <van-form action="/">
            <van-search
            v-model="value"
            placeholder="请输入搜索关键词"
            @search="toSearch"
            show-action
            @cancel="onCancel"
            />
          </van-form>
          </van-col>
      </van-row>
    </div>
    <!-- 历史内容 -->
    <div class="lishi">
      <van-grid :column-num="3">
        <van-grid-item v-for="value in 6" :key="value" icon="photo-o" text="文字" />
      </van-grid>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      value: ''
    }
  },
  created () {
  },
  methods: {
    async toSearch () {
      if (this.value.trim()) {
        this.$router.replace('/search/list/' + this.value)
      }
    },
    onCancel () {
      this.$router.back()
    }
  },
  mounted () {
  },
  directives: {
    focus: {
      inserted (e) {
        e.focus()
      }
    }
  }
}
</script>
